<?php
namespace model;
use \model\model_m;
class column_m extends model_m{
	public function __construct(){
			$this->table='column';
	}
	public function s_all_ajaxs($where=array(),$field='*',$order='id desc'){
		$pagesize=C('pagesize');
		$counts=M($this->table)->where($where)->select_one('count(id) as counts');
		$page=isset($_REQUEST['page'])?$_REQUEST['page']:1;
		$startRow=$pagesize * ($page - 1);
		$data['list']=M($this->table)->where($where)->order($order)->limit("$startRow,$pagesize")->select_all($field);
		$data['pageshow']=$this->pageajax_show($pagesize,$counts['counts']);
		return $data;
	}
	//添加老娘们
	public function a_one($data){
		return M($this->table)->insert_one($data);
	}
	public function s_one($where,$field='*'){
		return M($this->table)->where($where)->select_one($field);
	}
	public function e_one($where,$data){
		return M($this->table)->where($where)->update_one($data);
	}
	public function d_one($where){
		return M($this->table)->where($where)->delete_one();
	}
}
?>
